﻿//Copyright 2011 - Jonathan Allen

using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Collections.Specialized;
using Granite.ComponentModel;
using System.Collections;
using System.Diagnostics.CodeAnalysis;

namespace Granite.Collections
{
	///// <summary>
	///// 
	///// </summary>
	///// <typeparam name="T"></typeparam>
	///// <remarks>This class is not suitable for XAML-based data binding because it is not ordered.</remarks>
	//[SuppressMessage("Microsoft.Naming", "CA1710:IdentifiersShouldHaveCorrectSuffix")]
	//public class ObservableHashSet<T> : ISet<T>, INotifySetChanged
	//{
	//	private readonly ISet<T> m_Core = new HashSet<T>();

	//	/// <summary>
	//	/// Adds an element to the current set and returns a value to indicate if the element was successfully added. 
	//	/// </summary>
	//	/// <returns>
	//	/// true if the element is added to the set; false if the element is already in the set.
	//	/// </returns>
	//	/// <param name="item">
	//	/// The element to add to the set.
	//	/// </param>
	//	public bool Add(T item)
	//	{
	//		var result = m_Core.Add(item);
	//		if (result)
	//			OnSetChanged(new SetChangedEventArgs(NotifySetChangedAction.Add, item));
	//		return result;
	//	}

	//	/// <summary>
	//	/// Removes all elements in the specified collection from the current set.
	//	/// </summary>
	//	/// <param name="other"></param>
	//	public void ExceptWith(IEnumerable<T> other)
	//	{
	//		m_Core.ExceptWith(other);
	//		OnSetChanged(new SetChangedEventArgs(NotifySetChangedAction.Reset));
	//	}

	//	/// <summary>
	//	///  Modifies the current set so that it contains only elements that are also
	//	///  in a specified collection.
	//	/// </summary>
	//	/// <param name="other"></param>
	//	public void IntersectWith(IEnumerable<T> other)
	//	{
	//		m_Core.IntersectWith(other);
	//		OnSetChanged(new SetChangedEventArgs(NotifySetChangedAction.Reset));
	//	}

	//	/// <summary>
	//	/// Determines whether the current set is a property (strict) subset of a specified
	//	/// collection.
	//	/// </summary>
	//	/// <param name="other"></param>
	//	/// <returns></returns>
	//	public bool IsProperSubsetOf(IEnumerable<T> other)
	//	{
	//		return m_Core.IsProperSubsetOf(other);
	//	}

	//	/// <summary>
	//	/// Determines whether the current set is a correct superset of a specified collection.
	//	/// </summary>
	//	/// <param name="other"></param>
	//	/// <returns></returns>
	//	public bool IsProperSupersetOf(IEnumerable<T> other)
	//	{
	//		return m_Core.IsProperSupersetOf(other);
	//	}

	//	/// <summary>
	//	/// Determines whether a set is a subset of a specified collection.
	//	/// </summary>
	//	/// <param name="other"></param>
	//	/// <returns></returns>
	//	public bool IsSubsetOf(IEnumerable<T> other)
	//	{
	//		return m_Core.IsSubsetOf(other);
	//	}

	//	/// <summary>
	//	/// Determines whether the current set is a superset of a specified collection.
	//	/// </summary>
	//	/// <param name="other"></param>
	//	/// <returns></returns>
	//	public bool IsSupersetOf(IEnumerable<T> other)
	//	{
	//		return m_Core.IsSupersetOf(other);
	//	}

	//	/// <summary>
	//	/// Determines whether the current set and the specified collection contain the
	//	/// same elements.
	//	/// </summary>
	//	/// <param name="other"></param>
	//	/// <returns></returns>
	//	public bool Overlaps(IEnumerable<T> other)
	//	{
	//		return m_Core.Overlaps(other);
	//	}

	//	/// <summary>
	//	/// Determines whether the current set and the specified collection contain the
	//	/// same elements.
	//	/// </summary>
	//	/// <param name="other"></param>
	//	/// <returns></returns>
	//	public bool SetEquals(IEnumerable<T> other)
	//	{
	//		return m_Core.SetEquals(other);
	//	}

	//	/// <summary>
	//	/// Modifies the current set so that it contains only elements that are present
	//	/// either in the current set or in the specified collection, but not both.
	//	/// </summary>
	//	/// <param name="other"></param>
	//	public void SymmetricExceptWith(IEnumerable<T> other)
	//	{
	//		m_Core.SymmetricExceptWith(other);
	//		OnSetChanged(new SetChangedEventArgs(NotifySetChangedAction.Reset));
	//	}

	//	/// <summary>
	//	/// Modifies the current set so that it contains all elements that are present
	//	/// in both the current set and in the specified collection.
	//	/// </summary>
	//	/// <param name="other"></param>
	//	public void UnionWith(IEnumerable<T> other)
	//	{
	//		m_Core.UnionWith(other);
	//		OnSetChanged(new SetChangedEventArgs(NotifySetChangedAction.Reset));
	//	}

	//	/// <summary>
	//	/// Removes all items from the <see cref="T:System.Collections.Generic.ICollection`1" />.
	//	/// </summary>
	//	/// <exception cref="T:System.NotSupportedException">
	//	/// The <see cref="T:System.Collections.Generic.ICollection`1" /> is read-only. 
	//	/// </exception>
	//	public void Clear()
	//	{
	//		m_Core.Clear();
	//		OnSetChanged(new SetChangedEventArgs(NotifySetChangedAction.Reset));
	//	}

	//	/// <summary>
	//	/// Determines whether the <see cref="T:System.Collections.Generic.ICollection`1" /> contains a specific value.
	//	/// </summary>
	//	/// <returns>
	//	/// true if <paramref name="item" /> is found in the <see cref="T:System.Collections.Generic.ICollection`1" />; otherwise, false.
	//	/// </returns>
	//	/// <param name="item">
	//	/// The object to locate in the <see cref="T:System.Collections.Generic.ICollection`1" />.
	//	/// </param>
	//	public bool Contains(T item)
	//	{
	//		return m_Core.Contains(item);
	//	}

	//	/// <summary>
	//	/// 
	//	/// </summary>
	//	/// <param name="array"></param>
	//	/// <param name="arrayIndex"></param>
	//	public void CopyTo(T[] array, int arrayIndex)
	//	{
	//		m_Core.CopyTo(array, arrayIndex);
	//	}

	//	/// <summary>
	//	/// Gets the number of elements contained in the <see cref="T:System.Collections.Generic.ICollection`1" />.
	//	/// </summary>
	//	/// <returns>
	//	/// The number of elements contained in the <see cref="T:System.Collections.Generic.ICollection`1" />.
	//	/// </returns>
	//	public int Count
	//	{
	//		get { return m_Core.Count; }
	//	}

	//	/// <summary>
	//	/// Gets a value indicating whether the <see cref="T:System.Collections.Generic.ICollection`1" /> is read-only.
	//	/// </summary>
	//	/// <returns>
	//	/// true if the <see cref="T:System.Collections.Generic.ICollection`1" /> is read-only; otherwise, false.
	//	/// </returns>
	//	public bool IsReadOnly
	//	{
	//		get { return false; }
	//	}

	//	/// <summary>
	//	/// Removes the first occurrence of a specific object from the <see cref="T:System.Collections.Generic.ICollection`1" />.
	//	/// </summary>
	//	/// <returns>
	//	/// true if <paramref name="item" /> was successfully removed from the <see cref="T:System.Collections.Generic.ICollection`1" />; otherwise, false. This method also returns false if <paramref name="item" /> is not found in the original <see cref="T:System.Collections.Generic.ICollection`1" />.
	//	/// </returns>
	//	/// <param name="item">
	//	/// The object to remove from the <see cref="T:System.Collections.Generic.ICollection`1" />.
	//	/// </param>
	//	/// <exception cref="T:System.NotSupportedException">
	//	/// The <see cref="T:System.Collections.Generic.ICollection`1" /> is read-only.
	//	/// </exception>
	//	public bool Remove(T item)
	//	{
	//		var result = m_Core.Remove(item);
	//		if (result)
	//			OnSetChanged(new SetChangedEventArgs(NotifySetChangedAction.Remove, item));
	//		return result;
	//	}

	//	/// <summary>
	//	/// Returns an enumerator that iterates through the collection.
	//	/// </summary>
	//	/// <returns>
	//	/// A <see cref="T:System.Collections.Generic.IEnumerator`1" /> that can be used to iterate through the collection.
	//	/// </returns>
	//	/// <filterpriority>1</filterpriority>
	//	public IEnumerator<T> GetEnumerator()
	//	{
	//		return m_Core.GetEnumerator();
	//	}

	//	/// <summary>
	//	/// Returns an enumerator that iterates through the collection.
	//	/// </summary>
	//	/// <returns>
	//	/// A <see cref="T:System.Collections.Generic.IEnumerator`1" /> that can be used to iterate through the collection.
	//	/// </returns>
	//	/// <filterpriority>1</filterpriority>
	//	IEnumerator IEnumerable.GetEnumerator()
	//	{
	//		return m_Core.GetEnumerator();
	//	}

	//	/// <summary>
	//	/// Indicates the set changed.
	//	/// </summary>
	//	public event EventHandler<SetChangedEventArgs> SetChanged;

	//	void OnSetChanged(SetChangedEventArgs ea)
	//	{
	//		if (SetChanged != null)
	//			SetChanged(this, ea);
	//	}


	//	void ICollection<T>.Add(T item)
	//	{
	//		Add(item);
	//	}

	//}
}
